#ifndef YXLRU_H
#define YXLRU_H
#include "HashTable.h"

typedef struct YXLRUNode {
    void             *key;
    void             *value;
    struct YXLRUNode *prev;
    struct YXLRUNode *next;
} YXLRUNode;

typedef struct YXLRU {
    int        capacity;
    HashTable *table;
    YXLRUNode *dummy;
    void       (*keyDestroy)(void *value);
    void       (*valueDestroy)(void *value);
} YXLRU;

YXLRU *yx_lru_create(int capacity, void (*keyDestroy)(void *key), void (*valueDestroy)(void *value));
void  *yx_lru_get(YXLRU *lru, void *key);
void   yx_lru_put(YXLRU *lru, void *key, void *value);
void   yx_lru_print(YXLRU *lru);

#endif // YXLRU_H
